select b.ilockInfoNumber from Ilockloc as b where b.ilockLocTime in(select max(a.ilockLocTime) from Ilockloc as a group by a.ilockInfoNumber) and (CURRENT_TIMESTAMP()-b.ilockLocTime)>500